from typing import List


class Solution:
    def successfulPairs(self, spells: List[int], potions: List[int], success: int) -> List[int]:
        potions.sort()
        return [len(potions) - self.binary_search_ge(potions, spell, success) for spell in spells]

    def binary_search_ge(self, potions: List[int], coe, target):
        left = -1
        right = len(potions)
        while left + 1 < right:
            mid = (left + right) // 2
            if potions[mid] * coe >= target:
                right = mid
            else:
                left = mid
        return right
